import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '生产批次',
    align: "center",
    dataIndex: 'code'
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '生产量（L）',
    align: "center",
    dataIndex: 'orderNum'
  },
  {
    title: '生产员工',
    align: "center",
    dataIndex: 'executor'
  },
  {
    title: '负责人',
    align: "center",
    dataIndex: 'principal'
  },
  {
    title: '生产设备',
    align: "center",
    dataIndex: 'machine'
  },
  {
    title: '生产日期',
    align: "center",
    dataIndex: 'yieldDate'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "产品名称",
    field: 'name',
    component: 'Input',
    colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '生产批次',
    field: 'code',
    component: 'Input',
  },
  {
    label: '产品名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入产品名称!'},
             ];
    },
  },
  {
    label: '生产量（L）',
    field: 'orderNum',
    component: 'InputNumber',
  },
  {
    label: '生产员工',
    field: 'executor',
    component: 'Input',
  },
  {
    label: '负责人',
    field: 'principal',
    component: 'Input',
  },
  {
    label: '生产设备',
    field: 'machine',
    component: 'Input',
  },
  {
    label: '生产日期',
    field: 'yieldDate',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
